package com.university.vo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * City entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "city", catalog = "university")

public class City implements java.io.Serializable {

	// Fields

	private Integer cityId;
	private City city;
	private String cityName;
	private Integer cityLevel;
	private Set<School> schools = new HashSet<School>(0);
	private Set<City> cities = new HashSet<City>(0);
	private Set<Student> students = new HashSet<Student>(0);
	private Set<Company> companies = new HashSet<Company>(0);

	// Constructors

	/** default constructor */
	public City() {
	}

	@Override
	public String toString() {
		return "City [cityId=" + cityId + ", city=" + city + ", cityName=" + cityName + ", cityLevel=" + cityLevel
				+ ", schools=" + schools + ", cities=" + cities + ", students=" + students + ", companies=" + companies
				+ "]";
	}

	/** full constructor */
	public City(City city, String cityName, Integer cityLevel, Set<School> schools, Set<City> cities,
			Set<Student> students, Set<Company> companies) {
		this.city = city;
		this.cityName = cityName;
		this.cityLevel = cityLevel;
		this.schools = schools;
		this.cities = cities;
		this.students = students;
		this.companies = companies;
	}

	// Property accessors
	@Id
	@GeneratedValue

	@Column(name = "city_id", unique = true, nullable = false)

	public Integer getCityId() {
		return this.cityId;
	}

	public void setCityId(Integer cityId) {
		this.cityId = cityId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "city_parentId")

	public City getCity() {
		return this.city;
	}

	public void setCity(City city) {
		this.city = city;
	}

	@Column(name = "city_name", length = 10)

	public String getCityName() {
		return this.cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	@Column(name = "city_level")

	public Integer getCityLevel() {
		return this.cityLevel;
	}

	public void setCityLevel(Integer cityLevel) {
		this.cityLevel = cityLevel;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "city")

	public Set<School> getSchools() {
		return this.schools;
	}

	public void setSchools(Set<School> schools) {
		this.schools = schools;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "city")

	public Set<City> getCities() {
		return this.cities;
	}

	public void setCities(Set<City> cities) {
		this.cities = cities;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cities")

	public Set<Student> getStudents() {
		return this.students;
	}

	public void setStudents(Set<Student> students) {
		this.students = students;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cities")

	public Set<Company> getCompanies() {
		return this.companies;
	}

	public void setCompanies(Set<Company> companies) {
		this.companies = companies;
	}

}